﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using BadmintonApp.BLL.Interface;
using BadmintonApp.Entity;
using BadmintonApp.Factory;

namespace BadmintonApp.Win
{
    public partial class frmUserManage : Form
    {
        private IUsersBLL usersBLL = null;

        public frmUserManage()
        {
            InitializeComponent();

            usersBLL = BllFactory.CreateUsersBLL();
        }

        private void frmUserManage_Load(object sender, EventArgs e)
        {
            DataSet dsUsers = usersBLL.GetAllUsers();
            dgvUser.DataSource = dsUsers.Tables[0].DefaultView;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            TUsersInfo userInfo = new TUsersInfo();
            userInfo.FUserName = "henry.liu";
            userInfo.FDisplayName = "Henry Liu";
            userInfo.FCompany = "OOCL";
            userInfo.FDepartment = "ISD";
            userInfo.FMoney = 100;
            userInfo.FOffice = "ZHA";
            userInfo.FPassword = "123456";
            userInfo.FTitle = "Assitant Technical Engineer";
            usersBLL.InsertUser(userInfo);
            DataSet dsUsers = usersBLL.GetAllUsers();
            dgvUser.DataSource = dsUsers.Tables[0].DefaultView;
        }

        private void btnModify_Click(object sender, EventArgs e)
        {
            
        }
    }
}
